package leetcode.easy;

import leetcode.base.ListNode;

/**
 * ClassName: $234_IsPalindrome
 * Description:
 * date: 2021-12-14 10:06
 *
 * @author liyifan
 */
public class $234_IsPalindrome {
    ListNode left;
    public boolean isPalindrome(ListNode head) {
        left = head;
        return recur(head);
    }

    public boolean recur(ListNode right) {
        if (right == null)
            return true;

        boolean res = recur(right.next);
        res = res && (left.val == right.val);
        left = left.next;
        return res;
    }
}
